#include <queue>
using namespace std;
class MovingAverage
{
public:
    /** Initialize your data structure here. */
    MovingAverage(int _size) : size(_size), sum(0.0) { ; }

    double next(int val)
    {
        if (que.size() == size)
        {
            sum -= que.front();
            que.pop();
        }
        que.push(val);
        sum += que.back();
        return sum / que.size();
    }
    queue<int> que;
    int size;
    double sum;
};

/**
 * Your MovingAverage object will be instantiated and called as such:
 * MovingAverage* obj = new MovingAverage(size);
 * double param_1 = obj->next(val);
 */